// pages/index/mindAnwser/mindAnswer.js
// 引入全局的app.js文件对象
const app = getApp();

Page({
  data: {
    url: '',
    mindAnswerList: [],
  },
  goReply(e){
    let qid = e.currentTarget.dataset.qid
    // console.log(qid);
    wx.navigateTo({
      url: '/pages/index/mindAnwser/mindReply/mindReply?qid='+qid,
    })
  },

  goRaiseQ(){
    wx.navigateTo({
      url: './raiseQ/raiseQ',
    })
  },
  goIndex(){
    wx.switchTab({
      url: '../index/index',
    })
  },
  // 页面加载时动态的获取全局的url数据
  onLoad: function (option) {
    // 获取全局的url赋值给当前页面的URL变量
   this.setData({
     url:app.globalData.URL
   })
  //  console.log(this.data.url);
  //  console.log(666);
    // 动态调用后端接口 
    let that = this;
    wx.request({
     url: that.data.url+'question/findByPage',
     method: 'GET',
     data: {
      pageNum: 1,
      pageSize: 5,
      // title: '巧',
     },
     success(resp){
       console.log(resp.data.data.list)
       that.setData({
         mindAnswerList: resp.data.data.list
       })
     }
   })  
  },
  goQuestions(){
    wx.navigateTo({
      url: './lookAllQuestions/lookAllQuestions'
    })
  }
})